// -*- Mode: C++ -*-
/*++

Copyright (c) 1998 Microsoft Corporation

Abstract:

    Interface definitions for Windows Multimedia Runtime components

--*/

#define TIMEMEDIAPLAYEREVENTS_OFFSET                            0x0900
#define DISPID_TIMEMEDIAPLAYEREVENTS_BASE                       (TIMEMEDIAPLAYEREVENTS_OFFSET)
#define TIMEMEDIANATIVE_OFFSET                                  0x1600
#define DISPID_TIMEMEDIANATIVE_BASE                             (TIMEMEDIANATIVE_OFFSET)

//
// ITIMEMediaPlayerEvents
//
#define DISPID_TIMEMEDIAPLAYEREVENTS_ONBEGIN                    (DISPID_TIMEMEDIAPLAYEREVENTS_BASE + 0x01)
#define DISPID_TIMEMEDIAPLAYEREVENTS_ONEND                      (DISPID_TIMEMEDIAPLAYEREVENTS_BASE + 0x02)
#define DISPID_TIMEMEDIAPLAYEREVENTS_ONRESUME                   (DISPID_TIMEMEDIAPLAYEREVENTS_BASE + 0x03)
#define DISPID_TIMEMEDIAPLAYEREVENTS_ONPAUSE                    (DISPID_TIMEMEDIAPLAYEREVENTS_BASE + 0x04)
#define DISPID_TIMEMEDIAPLAYEREVENTS_ONMEDIAREADY               (DISPID_TIMEMEDIAPLAYEREVENTS_BASE + 0x05)
#define DISPID_TIMEMEDIAPLAYEREVENTS_ONMEDIALOADFAILED          (DISPID_TIMEMEDIAPLAYEREVENTS_BASE + 0x07)

//
// ITIMEMediaNative
//
#define DISPID_TIMEMEDIANATIVE_SEEKACTIVETRACK                  (DISPID_TIMEMEDIANATIVE_BASE + 0x01)
#define DISPID_TIMEMEDIANATIVE_TRACKTIME                        (DISPID_TIMEMEDIANATIVE_BASE + 0x02)

import "oleidl.idl";
import "oaidl.idl";
[
    uuid(CE210C64-596E-4355-85D0-106FB35F920F),
    version(1.0)
]
library TIMEP
{
    importlib("STDOLE2.TLB");

#if DBG
    [
        object,
        uuid(FAC64649-FD53-4A41-89B8-DA126CB9DD10),
        dual,
        pointer_default(unique),
    ]
    interface ITIMEDshowTestPlayerObject : IDispatch
    {
        [propget, id(1)] HRESULT mediaTime([out, retval] double * time);
        [propget, id(2)] HRESULT mediaState([out, retval] int * time);
        [id(3)] HRESULT pause();
        [id(4)] HRESULT resume();
        [propget, id(5)] HRESULT mediaRate([out, retval] double *rate);
        [propput, id(5)] HRESULT mediaRate([in] double rate);
    };
#endif
    
    [
        odl,
        oleautomation,
        dual,
        uuid(E6FAA0B2-69FE-11d2-B259-00A0C90D6111),
    ]
    interface ITIMEMediaPlayerOld : IDispatch
    {
        HRESULT Init();

        HRESULT clipBegin([in] VARIANT varClipBegin);
        HRESULT clipEnd([in] VARIANT varClipEnd);

        HRESULT begin();
        HRESULT end();

        HRESULT resume();
        HRESULT pause();

        HRESULT tick();

        [propput]
        HRESULT CurrentTime([in] double dblCurrentTime);
        [propget]
        HRESULT CurrentTime([out, retval] double *dblCurrentTime);

        [propput]
        HRESULT src([in] BSTR bstrURL);
        [propget]
        HRESULT src([retval, out] BSTR *pbstrURL);

        [propput]
        HRESULT repeat([in] long ltime);
        [propget]
        HRESULT repeat([retval, out] long *ltime);

        HRESULT cue();
    };

    [
        hidden,
        uuid(4539E412-7813-11d2-B25F-00A0C90D6111)
    ]
    dispinterface TIMEMediaPlayerEvents
    {
        properties:
        methods:
        [id(DISPID_TIMEMEDIAPLAYEREVENTS_ONBEGIN)]            void onbegin();
        [id(DISPID_TIMEMEDIAPLAYEREVENTS_ONEND)]              void onend();
        [id(DISPID_TIMEMEDIAPLAYEREVENTS_ONRESUME)]           void onresume();
        [id(DISPID_TIMEMEDIAPLAYEREVENTS_ONPAUSE)]            void onpause();
        [id(DISPID_TIMEMEDIAPLAYEREVENTS_ONMEDIAREADY)]       void onmediaready();
        [id(DISPID_TIMEMEDIAPLAYEREVENTS_ONMEDIALOADFAILED)]  void onmedialoadfailed();
    };

    [
        object,
        uuid(3e3535c0-445b-4ef4-8a38-4d379cbc9828),
        dual,
        pointer_default(unique)
    ]
    interface ITIMEMediaNative : IUnknown
    {
        [id(DISPID_TIMEMEDIANATIVE_SEEKACTIVETRACK), hidden]
        HRESULT seekActiveTrack([in] double dblSeekTime);

        [propget, id(DISPID_TIMEMEDIANATIVE_TRACKTIME), hidden]
        HRESULT activeTrackTime([out, retval] double *dblActiveTrackTime);
    };
	
    typedef [helpstring("ActiveMovie Readiness State")]
    enum {
        amvUninitialized = 0,
        amvLoading = 1,
        amvInteractive = 3,
        amvComplete = 4
    } ReadyStateConstants;

    [
      uuid(2D3A4C40-E711-11D0-94AB-0080C74C7E95),
      helpstring("Event interface for Windows Media Player control"),
      hidden
    ]
    dispinterface _MediaPlayerEvents {
        properties:
        methods:
            [id(0x000005e1), helpstring("DVD related notifications")]
            void DVDNotify(
                            [in] long EventCode, 
                            [in] long EventParam1, 
                            [in] long EventParam2);
            [id(0x00000bba), helpstring("Sent when the end of file is reached")]
            void EndOfStream([in] long Result);
            [id(0xfffffda6), helpstring("Sent when a key is pressed")]
            void KeyDown(
                            [in] short KeyCode, 
                            [in] short ShiftState);
            [id(0xfffffda4), helpstring("Sent when a key is released")]
            void KeyUp(
                            [in] short KeyCode, 
                            [in] short ShiftState);
            [id(0xfffffda5), helpstring("Sent when a character is entered")]
            void KeyPress([in] short CharacterCode);
            [id(0xfffffda2), helpstring("Sent when the mouse is moved")]
            void MouseMove(
                            [in] short Button, 
                            [in] short ShiftState, 
                            [in] OLE_XPOS_PIXELS x, 
                            [in] OLE_YPOS_PIXELS y);
            [id(0xfffffda3), helpstring("Sent when a mouse button is pressed")]
            void MouseDown(
                            [in] short Button, 
                            [in] short ShiftState, 
                            [in] OLE_XPOS_PIXELS x, 
                            [in] OLE_YPOS_PIXELS y);
            [id(0xfffffda1), helpstring("Sent when a mouse button is released")]
            void MouseUp(
                            [in] short Button, 
                            [in] short ShiftState, 
                            [in] OLE_XPOS_PIXELS x, 
                            [in] OLE_YPOS_PIXELS y);
            [id(0xfffffda8), helpstring("Sent when a mouse button is clicked")]
            void Click(
                            [in] short Button, 
                            [in] short ShiftState, 
                            [in] OLE_XPOS_PIXELS x, 
                            [in] OLE_YPOS_PIXELS y);
            [id(0xfffffda7), helpstring("Sent when a mouse button is double clicked")]
            void DblClick(
                            [in] short Button, 
                            [in] short ShiftState, 
                            [in] OLE_XPOS_PIXELS x, 
                            [in] OLE_YPOS_PIXELS y);
            [id(0x00000bc3), helpstring("Sent when the control changes OpenState")]
            void OpenStateChange(
                            [in] long OldState, 
                            [in] long NewState);
            [id(0x00000bc4), helpstring("Sent when the control changes PlayState")]
            void PlayStateChange(
                            [in] long OldState, 
                            [in] long NewState);
            [id(0x00000bb9), helpstring("Sent when a synchronized command or URL is received")]
            void ScriptCommand(
                            [in] BSTR scType, 
                            [in] BSTR Param);
            [id(0x00000bbb), helpstring("Sent when the control begins or ends buffering")]
            void Buffering([in] VARIANT_BOOL Start);
            [id(0x00000bc2), helpstring("Sent when the control has an error condition")]
            void Error();
            [id(0x00000bbe), helpstring("Sent when a marker is reached")]
            void MarkerHit([in] long MarkerNum);
            [id(0x00000bc1), helpstring("Sent when the control encounters a problem")]
            void Warning(
                            [in] long WarningType, 
                            [in] long Param, 
                            [in] BSTR Description);
            [id(0x00000bc0), helpstring("Sent when a new stream is started in a channel")]
            void NewStream();
            [id(0x00000bbc), helpstring("Sent when the control is disconnected from the server")]
            void Disconnect([in] long Result);
            [id(0x00000002), helpstring("Indicates that the current position of the movie has changed")]
            void PositionChange(
                            [in] double oldPosition, 
                            [in] double newPosition);
            [id(0x00000033), helpstring("Indicates that the display mode of the movie has changed")]
            void DisplayModeChange();
            [id(0xfffffd9f), helpstring("Reports that the ReadyState property of the ActiveMovie Control has changed")]
            void ReadyStateChange([in] ReadyStateConstants ReadyState);
    };

    typedef 
    [
        public
    ]
    enum fireEvent {
        OnShow,
        OnHide,
    } fireEvent;

    [
        object,
        uuid(EF508011-C806-4356-8492-D15E616F6F37),
        pointer_default(unique)
    ]
    interface IContentProxy : IUnknown
    {
        HRESULT OnCreatedPlayer();
        HRESULT fireEvent(enum fireEvent event);
        HRESULT detachPlayer();
    };

    [
		object,
        uuid(911A444E-B951-43ea-B3AA-17EFC2879831),
        pointer_default(unique)
    ]
    interface ITIMEContentPlayerSite : IUnknown
    {
        HRESULT GetEventRelaySite (IUnknown **ppiEventRelaySite);
    };
}
